<?php

class DBHelper{

  public static function executeQuery($query) {
    $con = mysql_connect ("localhost", "root", "") or die("Could not connect");
    $db = mysql_select_db ("smartrfid") or die("Database does not exist or no permission");
    
    $result =  mysql_query(mysql_real_escape_string($query));
    $response = array();
    if ($result) {
      while ($row = mysql_fetch_assoc($result)) {
	array_push($response, $row);
      }
    }
    //echo $query;
    mysql_close($con);
    return $response;
  }
  public static function updateQuery($query) {
    $con = mysql_connect ("localhost", "root", "") or die("Could not connect");
    $db = mysql_select_db ("smartrfid") or die("Database does not exist or no permission");
    $result =  mysql_query($query);
    mysql_close($con);
    return $result;
  }
}


?>